package cn.skyquant.quant4j.api.ea;

import cn.skyquant.quant4j.api.enums.BorkerType;
import cn.skyquant.quant4j.api.enums.RunStatus;
import cn.skyquant.quant4j.sdk.enums.Status;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

public class EAManagerDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    public Integer id;
    public String ea;
    public Integer eaId;
    public String accountCode;
    public BorkerType borkerType;
    public String remoteIp;
    public String localIp;
    public RunStatus runStatus;
    public Date startTime;
    public Date stopTime;
    public Date heartbeat2;
    public Date heartbeat1;
    public Date heartbeat0;
    public Date borkerTime;
    public Status eaStatus;
    public String username;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof EAManagerDTO)) return false;
        EAManagerDTO that = (EAManagerDTO) o;
        return Objects.equals(ea, that.ea) &&
                Objects.equals(eaId, that.eaId) &&
                Objects.equals(accountCode, that.accountCode) &&
                borkerType == that.borkerType;
    }

    @Override
    public int hashCode() {
        return Objects.hash(ea, eaId, accountCode, borkerType);
    }

    @Override
    public String toString() {
        return "EAManagerDTO{" +
                "id=" + id +
                ", ea='" + ea + '\'' +
                ", eaId=" + eaId +
                ", accountCode='" + accountCode + '\'' +
                ", borkerType=" + borkerType +
                ", eaStatus=" + eaStatus +
                '}';
    }
}
